
<%@include file="includes/top.jsp"%>
<h1><spring:message code="${pageTitle}" /></h1>
<form:form action="${fn:length(user.id) > 0 ? 'editUser.html' : 'addUser.html'}?id=${fn:escapeXml(param.id)}" cssClass="v" cssStyle="width:75%;" commandName="${commandName}">
	
  <c:if test="${not empty successMessage}">
			<div id="msg" class="info">${successMessage}</div>
		</c:if>

		<spring:hasBindErrors name="${commandName}">
			<div id="msg" class="errors">
			  <spring:message code="application.errors.global" />
		  </div>
		</spring:hasBindErrors>
		
	<fieldset class="repeat"><legend><spring:message code="management.user.add.page" /></legend>
	<div class="fieldset-inner">
		<p class="instructions"><spring:message code="management.services.add.instructions" /></p>
		<c:if test="${user.isManageUser eq 'true'}">
			      <span class="oneField" style="display:none; margin:5px 0;">
							<label for="name" class="preField"><spring:message code="management.user.add.property.name" /> </label>
							<form:input path="name" size="51" maxlength="50" cssClass="required" cssErrorClass="error" value="${user.name}"/>
							<form:errors path="name" cssClass="formError" />
								<span class="oneChoice">
									<form:checkbox path="isManageUser" value="true" cssClass="check" checked="checked"/>
									<label for="isManageUser" id="isManageUser" class="postField"><spring:message code="management.user.add.property.ismanageuser.enabled" /></label>
								</span>
							<br />
						</span>
		        <span class="oneField" style="display:block; margin:5px 0;">
								<label for="password" class="preField"><spring:message code="management.user.add.property.password" /> </label>
								<form:password path="password" size="51" maxlength="50" cssClass="required" cssErrorClass="error" />
								<form:errors path="password" cssClass="formError" />
								<br />
						</span>
		</c:if>
		<c:if test="${user.isManageUser ne 'true'}">
			<span class="oneField" style="display:block; margin:5px 0;">
				<label for="name" class="preField"><spring:message code="management.user.add.property.name" /> </label>
				<form:input path="name" size="51" maxlength="50" cssClass="required" cssErrorClass="error" />
				<form:errors path="name" cssClass="formError" />
					<span class="oneChoice">
						<form:checkbox path="isManageUser" value="true" cssClass="check" />
						<label for="isManageUser" id="isManageUser" class="postField"><spring:message code="management.user.add.property.ismanageuser.enabled" /></label>
					</span>
				<br />
			</span>
			<span class="oneField" style="display:block; margin:5px 0;">
				<label for="password" class="preField"><spring:message code="management.user.add.property.password" /> </label>
				<form:password path="password" size="51" maxlength="50" cssClass="required" cssErrorClass="error" />
				<form:errors path="password" cssClass="formError" />
				<br />
			</span>
			<c:forEach items="${user.property}" var="property" varStatus="status">
				<c:forEach items="${user.col}" var="col" varStatus="status">
					<c:if test="${col.key eq property.colName}">
							<span class="oneField">
								<label for="${property.colName}" class="preField">${property.label}</label>
								<form:input path="col['${col.key}']" size="${property.colLength}" maxlength="${property.colLength}" cssClass="required" cssErrorClass="error" />
								<form:errors path="col['${col.key}']" cssClass="formError" />
								<br />
						  </span>
					</c:if>			
				</c:forEach>
			</c:forEach>
    </c:if>
	</div>
	</fieldset>
	<div class="actions">
		<button type="submit" class="primaryAction" id="submit-wf_FormGardenDemonst" value="<spring:message code="management.services.add.button.save" />">
		<spring:message code="management.services.add.button.save" /></button> 
		or <a href="manageUser.html" style="color:#b00;"><spring:message code="management.services.add.button.cancel" /></a>
	</div>
</form:form>
<%@include file="includes/bottom.jsp" %>
